package com.shu.hash;

public class RedisKeyConstant {

	/**
	 * PK Redis prefix key.
	 */
	private final static String PK_PREFIX = "com:mzj:eagle:pk:";
	
	/**
	 * Redis分组排名Key前缀
	 */
	public final static String PK_GROUP_RANKING_PREFIX = PK_PREFIX+"group:%s:%s:%s";
	
	/**
	 * 个人用户的分信息
	 */
	public final static String PK_USER_SCORE_INFO = PK_PREFIX+"%s:%s:%s:%s:score";
	
	/**
	 * Redis点赞组Key前缀
	 */
	public final static String PK_GROUP_LIKE_PREFIX = PK_PREFIX+"like:%s";
	
	/**
	 * PK榜 查询所有appid对应的区域
	 */
	public final static String PK_QUERY_APPID_AREA = "OFFICIAL_ACCOUNTS";
	public final static String PK_QUERY_APPID_AREA_SUB_SUFFIX  = "_AUTHORIZER_INFO";
	public final static String PK_QUERY_WEBCHAT_USER = "WECHAT_USERINFO_";
	
	private final static int USER_KEY_NUM = 800;

	public static String getUserInfoKey(String unionId) {
		int hashCode = unionId.hashCode();
		int hashCodeAbs = Math.abs(hashCode);
		return PK_QUERY_WEBCHAT_USER + (hashCodeAbs % USER_KEY_NUM);
	}
	
	public static void main(String[] args) {
		System.out.println(getUserInfoKey(""));
	}

}
